//
//  CCHomeController.m
//  ccZone
//
//  Created by 陈小娟 on 2017/12/13.
//  Copyright © 2017年 CC. All rights reserved.
//

#import "CCHomeController.h"
#import "CCMineController.h"
#import "CCHomeAdapter.h"
#import "CCLoginNetWorkTool.h"
@interface CCHomeController ()<CCBaseAdapterDelegate>

@property(nonatomic,strong)CCTableView *hTable;
@property(nonatomic,strong)CCHomeAdapter *hAdapter;

@end

@implementation CCHomeController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.ku_navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注销" style:(UIBarButtonItemStylePlain) target:self action:@selector(logout)];

    _hTable = [[CCTableView alloc]initWithFrame:CGRectZero];
    _hAdapter =[[CCHomeAdapter alloc]init];
    _hAdapter.delegate = self;
    _hTable.tableFooterView =[[UIView alloc]initWithFrame:CGRectZero];
    _hTable.dataSource = _hAdapter;
    _hTable.delegate = _hAdapter;
    [self.contentView addSubview:_hTable];
    [_hTable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.kwNavBar.mas_bottom);
        make.left.right.equalTo(@0);
        make.bottom.equalTo(@(-49));
    }];
}

//-(void)logout {
//    //注销
//    [[NSNotificationCenter defaultCenter]postNotificationName:CCLogoutNotice object:nil];
//}

-(void)selectCellatRow:(NSUInteger)row atSection:(NSUInteger)section {
    BaseModel *m = self.hAdapter.dataArray[section][row];
    UIViewController *vc = [[NSClassFromString(m.cType) alloc] init];
    vc.title = m.cDetail;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
